#ifndef CONFIGMANAGER_H
#define CONFIGMANAGER_H

#include <QString>
#include <QMap>
#include "../nlohmann/json.h"

using json = nlohmann::json;

class ConfigManager {
public:
    static ConfigManager &instance();

    bool loadConfig(const QString &path);

    bool isLoaded() const;

    QString getString(const QString &keyPath, const QString &defaultValue = "");

    int getInt(const QString &keyPath, int defaultValue = 0);

    double getDouble(const QString &keyPath, double defaultValue = 0);

    bool getBool(const QString &keyPath, bool defaultValue = false);

private:
    ConfigManager() = default;

    json m_config;

    bool m_loaded = false;

    json *findJsonByPath(const QString &keyPath);
};

#endif // CONFIGMANAGER_H
